package Lab4;

import java.util.ArrayList;
import java.util.Arrays;

public class GenericMax {
    public static <E extends Comparable<E>> E max(ArrayList<E> list){
        E max = list.getFirst();
        for(E e:list){
            if(e.compareTo(max)>0)
                max = e;
        }
        return max;
    }

    public static void main(String[] args){
        ArrayList<Integer> l = new ArrayList<>(Arrays.asList(0,1,2,3,4,5));
        System.out.println(max(l));
    }
}
